
#include <stdio.h>
#include <stdlib.h>

#include "SeqTree.h"
#include "BinaryTree.h"

void TestSeqTree();

void TestBinaryTree();


int main() {
    TestBinaryTree();
    return 0;
}


void TestSeqTree() {
    SeqBinTree tree;
    /* 1. 初始化树 */
    InitSeqTree(tree);
    printf("place input root Element: ");
    /* 2. 创建树 */
    CreateSeqTree(tree, 0);
    /* 输出树 */
    PrintTree(tree);

    printf("\n");

    /* 2021/11/04 19:33 add */
    printf("总节点数: %d\n", GetSeqTreeLength(tree));
    printf("当前深度: %d\n", GetSeqTreeDepth(tree));

}

void TestBinaryTree() {
    BinaryTree tree;

    InitBinaryTree(&tree);

    tree.root = (TreeNode *) malloc(sizeof(TreeNode));

    printf("请输入根节点: ");
    CreateBinaryTree(tree.root);

    printf("\n\n先序遍历: \n");
    PreOrderTraverse(tree.root);

    printf("\n\n中序遍历结果: \n");
    InOderTraverse(tree.root);

    printf("\n\n后序遍历: \n");
    PostOrderTraverse(tree.root);
    free(tree.root);
}